<?php
//Views
require_once("View/PageView.php");
require_once("View/MemberView.php");
require_once("View/NavigationView.php");

//Controllers
require_once("Controller/MemberCatalogController.php");
require_once("Controller/AddMemberController.php");

//Database
require_once("Database/Database.php");
require_once("Database/DatabaseSettings.php");

class MasterController 
{
        public static function doControll() 
        {
        	$db = new Database();
         	$db->Connect(new DatabaseSettings());
			
			//Controller objekt
        	$mcc = new MemberCatalogController();
			$amc = new AddMemberController();
			
			$html = null;
   			
			if(NavigationView::UserWantsToViewDetailedList() == true ||
			   NavigationView::UserWantsToViewList() == true ||
			   NavigationView::UserWantsToViewSpecificMember() == true)
			{
   				$html = $mcc->DoControll($db);
			}
			else if (NavigationView::UserWantsToAddMember() == true)
			{
				$html = $amc->DoControll($db);
			}

			$db->Close();
			
            $pw = new PageView;                         
            return $pw->GetHTMLPage("Workshop2", $html);
        }
        
}

echo MasterController::doControll();

?>